package com.swt.dao.impl.S_impl;

import com.swt.domain.Club;
import org.hibernate.criterion.DetachedCriteria;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository(value = "s_getclubdao")
public class GetClubDaoImpl implements com.swt.dao.S_dao.GetClubDao {
    /*注入hibernateTemplate*/
    @Resource(name = "hibernateTemplate")
    private HibernateTemplate hibernateTemplate;
    @Override
    public List<Club> S_getClub() {
        DetachedCriteria detachedCriteria = DetachedCriteria.forClass(Club.class);
        List<Club> list= (List<Club>)hibernateTemplate.findByCriteria(detachedCriteria);
        return list;
    }

    @Override
    public Club getclubByib(int clubId) {

        Club club = hibernateTemplate.get(Club.class, clubId);
        return club;
    }
}
